<?php
/**
 * Created by PhpStorm.
 * User: Guangpeng Chen
 * 资源库列表
 * Date: 15-7-27
 * Time: 下午3:27
 */
use \PFT\Db;
use \PFT\Resource;
include '/var/www/html/new/d/common/page.php';
include '/var/www/html/new/d/common/area.inc.php';
include '/var/www/html/new/d/module/common/Db.class.php';
$dbConf = include '/var/www/html/new/d/module/common/db.conf.php';// 远端服务器配置信息
Db::Conf($dbConf['localhost']);

$currentPage = $_REQUEST["currentPage"]? intval($_REQUEST["currentPage"]):1;
$pageSize    = $_REQUEST["pageSize"]?intval($_REQUEST["pageSize"]):10;
$offset      = ($currentPage-1)*$pageSize;
include 'Resource.class.php';
$obj = new Resource(Db::Connect());

$search = array();
if (isset($_GET['title']) && $_GET['title']!=''){
    $search['title'] = safetxt($_GET['title']);
}
if (isset($_GET['lvl']) && $_GET['lvl']!='ALL' && $_GET['lvl']!=''){
    $search['jtype'] = safetxt($_GET['lvl']);
}
if (isset($_GET['type']) && $_GET['type']!='ALL' && $_GET['type']!=''){
    $search['p_type'] = safetxt($_GET['type']);
}
if (isset($_GET['verify_status']) && $_GET['verify_status']!='ALL' && $_GET['verify_status']!='') {
    $search['verify_status'] = safetxt($_GET['verify_status']);
}
/*
if (isset($_GET['d_city']) && $_GET['d_city']!='') {//选择了市
    $search['areacode'] = safetxt($_GET['d_city']);
}
if (isset($_GET['d_province']) && $_GET['d_province']!='' && $_GET['d_city']=='') {//选择了省没选市
    $search['d_province'] = safetxt($_GET['d_province']);
}*/
if($_GET['d_province']+0>0){
    $d_city = $_GET['d_city']+0==0 ?'':$_GET['d_city'].'|0';
    if($_GET['d_province']==1||$_GET['d_province']==2||$_GET['d_province']==3||$_GET['d_province']==4 ||$_GET['d_province']==32||$_GET['d_province']==33 ||$_GET['d_province']==34){
        $d_city = '1|0';
    }
    $search['area'] = ($_GET['d_province']+0).'|'.$d_city;

}
$data  = $obj->show($search, false, $offset, $pageSize);
$total = $obj->show($search, true, $offset, $pageSize);
$r     = $obj->show($search, false, $offset, $total);
$type_cnt = $obj->CountProduct();
$total = array_sum($type_cnt);
$total_items = $obj->show($search, true);

Db::Close();

$ptypes = array('A'=>'景区门票','B'=>'旅游线路','C'=>'度假酒店','D'=>'旅游商品','F'=>'套票');
$LevelList = array(
    'A'=>array(0=>'其他',3=>'3A级',4=>'4A级',5=>'5A级','3A'=>'3A级','4A'=>'4A级','5A'=>'5A级',),
    'C'=>array(0=>'其他',3=>'3星级',4=>'4星级',5=>'5星级','3A'=>'3星级','4A'=>'4星级','5A'=>'5星级',),//☆
);
$status_list = array(0=>'未审核',1=>'已审核');
$status_color = array(0=>'#f07845',1=>'#303D46');
include ROOT_PATH .'tpl/pft_resource/list.html';